package com.ht.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;

@Configuration
public class Swagger2Config {
    @Bean
    public Docket createRestApi() {
        return new Docket(DocumentationType.SWAGGER_2)
                .apiInfo(apiInfo())
                .select()
                //将我们那个包下的接口生成接口文档,扫描生成接口文档的包
                .apis(RequestHandlerSelectors.basePackage("com.ht.controller"))
                .paths(PathSelectors.any())
                .build();
    }
    //接口文档的详细信息
    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("医生端微服务接口文档")  // 大标题
                .description("这个接口有一些关于医生端的审核.....") //描述
                .termsOfServiceUrl("http://www.ddit.com")  //网络服务地址(项目的官网地址)
                .version("1.0.0")     //版本号
                .build();
    }

}
